import request from '@/utils/request'
import Qs from 'qs'

// llx--0
// 用户登录
export function userLogin(data) {
  return request({
    url: 'back/manager/login',
    method: 'post',
    data,
    // data:Qs.parse(data)
    headers:{'content-type': 'application/json'}
  })
}

// 退出登录
export function logout() {
  return request({
    url: '/back/manager/logout',
    method: 'get'
  })
}

//修改密码
export function updatePassword(data) {
  return request({
    method: 'put',
    data,
    url: '/back/manager/updatePwd'
  })
}

export function getUserInfo() {
  return request({
    url: 'back/manager/get',
    method: 'get'
  })
}

// llx--1



// 管理员列表
export function getList(params) {
  return request({
    url: '/api/sys-manager/admin/getManagerlist',
    method: 'get',
    params
  })
}

// 一级管理员下拉框
export function dropDownAgent(params) {
  return request({
    url: '/api/agent/admin/dropDownAgent',
    method: 'get',
    params
  })
}



//新增管理员呢

export function addAgent(data) {
  return request({
    method: 'post',
    data: Qs.stringify(data),
    url: '/api/sys-manager/admin/setManager',
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    }

  })
}
export function updateAgentIsFlag(data) {
  return request({
    method: 'post',
    data: Qs.stringify(data),
    url: '/api/agent/admin/updateAgentIsFlag',
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    }
  })
}

export function updateAgent(data) {
  return request({
    method: 'post',
    data: Qs.stringify(data),
    url: '/api/agent/admin/updateAgent',
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    }
  })
}
export function agentInfo(params) {
  return request({
    url: '/api/agent/admin/agentInfo',
    method: 'get',
    params
  })
}


//修改密码
export function updateAgentPassword(data) {
  return request({
    method: 'post',
    data: Qs.stringify(data),
    url: '/api/agent/admin/updateAgentPassword',
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    }
  })
}
